<? $section='SalesOrder'; ?>
<?
        require_once 'inc/functions.php';
        $conn = getConnection();
        //print_r($conn);
        $result = $conn->query('SELECT * FROM Proj_SalesOrder');
                
?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Home</title>
</head>

<body>
<? include("inc/tabs.php"); ?>
<h2>Sales Order</h2>

<table border ="1">
        <tr>
        <th>Sales Order ID</th>
        <th>Order Date</th>
        <th>Ship Date</th>
        <th>Status</th>
        <th>Sales Order #</th>
	<th>Customer ID</th>
	<th>Ship Method</th>
	<th>Payment ID</th>
	<th>Tax Amount</th>
	<th>Ship Cost</th>
	<th>Total Cost</th>
	<th>Updated At</th>
        </tr>
    
<? while($rs = $result->fetch_assoc()) { ?>
     <tr>
     <td><?=$rs['SalesOrder_id']?></td>
     <td><?=$rs['OrderDate']?></td>
     <td><?=$rs['ShipDate']?></td>
     <td><?=$rs['Status']?></td>
     <td><?=$rs['SalesOrderNumber']?></td>
     <td><?=$rs['Customer_id']?></td>
     <td><?=$rs['ShipMethod']?></td>
     <td><?=$rs['Payment_id']?></td>
     <td><?=$rs['TaxAmt']?></td>
     <td><?=$rs['ShipCost']?></td>
     <td><?=$rs['TotalCost']?></td>
     <td><?=$rs['updated_at']?></td>

<? } ?>
</table>
<? $result = $conn->query('SELECT * FROM Proj_SalesOrderDetail'); ?>
<h2>Sales Order Detail</h2>

<table border ="1">
        <tr>
        <th>Sales Order ID</th>
        <th>Sales Order Detail ID</th>
        <th>Order Qty</th>
	<th>Product ID</th>
	<th>Unit Price</th>
	<th>Unit Price Discount</th>
	<th>Total Price</th>
	<th>Updated At</th>
        </tr>
    
<? while($rs = $result->fetch_assoc()) { ?>
     <tr>
     <td><?=$rs['SalesOrder_id']?></td>
     <td><?=$rs['SalesOrderDetail_id']?></td>
     <td><?=$rs['OrderQty']?></td>
     <td><?=$rs['Product_id']?></td>
     <td><?=$rs['UnitPrice']?></td>
     <td><?=$rs['UnitPriceDiscount']?></td>
     <td><?=$rs['TotalPrice']?></td>
     <td><?=$rs['updated_at']?></td>
     </tr>
<? } ?>
</table>
</body>
</html>

<? $conn->close(); ?>